// Copyright (c) Pomelo Foundation. All rights reserved.
// Licensed under the MIT. See LICENSE in the project root for license information.

using System;
using System.Collections.Generic;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Utilities;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.EntityFrameworkCore.Migrations;

// ReSharper disable once CheckNamespace
namespace Microsoft.EntityFrameworkCore.Internal
{
    public class MyCatOptionsExtension : RelationalOptionsExtension
    {
        private long? _serviceProviderHash;
        private bool? _rowNumberPaging;
        private string _logFragment;
        public MyCatOptionsExtension()
        {
            this.WithMinBatchSize(1);
        }

        public MyCatOptionsExtension([NotNull] MyCatOptionsExtension copyFrom)
            : base(copyFrom)
        {
            this.WithMinBatchSize(1);
        }


        public override bool ApplyServices(IServiceCollection services)
        {
             Check.NotNull(services, nameof(services)).AddEntityFrameworkMyCat();
              return true;
        }
     

        protected override RelationalOptionsExtension Clone()
           => new MyCatOptionsExtension(this);

        public IList<MyCatDataNode> DataNodes { get; set; } = new List<MyCatDataNode>();

        /// <summary>
        ///     This API supports the Entity Framework Core infrastructure and is not intended to be used
        ///     directly from your code. This API may change or be removed in future releases.
        /// </summary>
        public virtual bool? RowNumberPaging => _rowNumberPaging;

        /// <summary>
        ///     This API supports the Entity Framework Core infrastructure and is not intended to be used
        ///     directly from your code. This API may change or be removed in future releases.
        /// </summary>
        public virtual MyCatOptionsExtension WithRowNumberPaging(bool rowNumberPaging)
        {
            var clone = (MyCatOptionsExtension)Clone();

            clone._rowNumberPaging = rowNumberPaging;

            return clone;
        }

    }
}
